package com.wlyuan.open.domain.api.assembler;

import com.wlyuan.core.marker.MappingStatus;
import com.wlyuan.open.domain.api.OpenApiInfo;
import com.wlyuan.open.domain.api.utils.MappingOpenApiInfo;
import com.wlyuan.open.vo.OpenApiCompanyDetailVO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;

/**
 * @author yuanzheng
 */
public class OpenApiInfoAssembler {

    @Mapper(uses = {MappingOpenApiInfo.class, MappingStatus.class})
    public interface Assembler {

        @Mappings({
                @Mapping(source = "applyId", target = "id")
        })
        OpenApiInfo assemble(OpenApiCompanyDetailVO source);

    }

    private static final Assembler ASSEMBLER = Mappers.getMapper(Assembler.class);

    public static OpenApiInfo assemble(OpenApiCompanyDetailVO source) {
        return ASSEMBLER.assemble(source);
    }


}
